package com.example.network_lib.util;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import com.example.application.BaseApplication;

/**
 * @author Administrator
 * @createTime 2019/9/27 23:23
 */
public class Tools {
    public static String getAppVersion() {
        String versionName = "1.0.0";
        try {
            PackageInfo packageInfo = BaseApplication.getAppContext().getPackageManager().getPackageInfo(BaseApplication.getAppContext().getPackageName(), 0);
            versionName = packageInfo.versionName;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        return versionName;
    }
}
